﻿using System;
using GeoAPI.Geometries;
using YJKGridTopologyCal.Planargraph;
using YJKGridTopologyCal.Utilities;

namespace YJKGridTopologyCal.Operation.Linemerge
{
	public class LineMergeDirectedEdge : DirectedEdge
	{
		public LineMergeDirectedEdge(Node from, Node to, Coordinate directionPt, bool edgeDirection) : base(from, to, directionPt, edgeDirection)
		{
		}

		public LineMergeDirectedEdge Next
		{
			get
			{
				if (base.ToNode.Degree != 2)
				{
					return null;
				}
				if (base.ToNode.OutEdges.Edges[0] == base.Sym)
				{
					return (LineMergeDirectedEdge)base.ToNode.OutEdges.Edges[1];
				}
				Assert.IsTrue(base.ToNode.OutEdges.Edges[1] == base.Sym);
				return (LineMergeDirectedEdge)base.ToNode.OutEdges.Edges[0];
			}
		}
	}
}
